Xen PM: Enter all ACPI S states on boot CPU.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 20 Jul 2007 09:38:51 +0000 (10:38 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 20 Jul 2007 09:38:51 +0000 (10:38 +0100)
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/acpi/power.c

index 69a2f1febf7243ba3f0ee093c401a8b5bcd812aa..3435955cd224924ca65042192bccaa3c765237a4 100644 (file)
@@ -124,7 +124,7 @@ static int enter_state(u32 state)
 
     if ( !spin_trylock(&pm_lock) )
         return -EBUSY;
-    
+
     pmprintk(XENLOG_INFO, "PM: Preparing system for %s sleep\n",
         acpi_states[state]);
 
@@ -153,12 +153,15 @@ static int enter_state(u32 state)
 
     switch ( state )
     {
-        case ACPI_STATE_S3:
-            do_suspend_lowlevel();
-            break;
-        default:
-            error = -EINVAL;
-            break;
+    case ACPI_STATE_S3:
+        do_suspend_lowlevel();
+        break;
+    case ACPI_STATE_S5:
+        acpi_enter_sleep_state(ACPI_STATE_S5);
+        break;
+    default:
+        error = -EINVAL;
+        break;
     }
 
     pmprintk(XENLOG_INFO, "Back to C!\n");
@@ -183,14 +186,6 @@ static int enter_state(u32 state)
     return error;
 }
 
-static void acpi_power_off(void)
-{
-    pmprintk(XENLOG_INFO, "%s called\n", __FUNCTION__);
-    local_irq_disable();
-    /* Some SMP machines only can poweroff in boot CPU */
-    acpi_enter_sleep_state(ACPI_STATE_S5);
-}
-
 static long enter_state_helper(void *data)
 {
     struct acpi_sleep_info *sinfo = (struct acpi_sleep_info *)data;
@@ -227,7 +222,7 @@ int acpi_enter_sleep(struct xenpf_enter_acpi_sleep *sleep)
     if ( !(sleep->pm1a_cnt_val & ACPI_BITMASK_SLEEP_ENABLE) )
     {
         outw((u16)sleep->pm1a_cnt_val, acpi_sinfo.pm1a_cnt);
-        if (acpi_sinfo.pm1b_cnt)
+        if ( acpi_sinfo.pm1b_cnt )
             outw((u16)sleep->pm1b_cnt_val, acpi_sinfo.pm1b_cnt);
         return 0;
     }
@@ -237,13 +232,6 @@ int acpi_enter_sleep(struct xenpf_enter_acpi_sleep *sleep)
     acpi_sinfo.pm1b_cnt_val = sleep->pm1b_cnt_val;
     acpi_sinfo.sleep_state = sleep->sleep_state;
 
-    /* ACPI power-off method. */
-    if ( acpi_sinfo.sleep_state == ACPI_STATE_S5 )
-    {
-        for ( ; ; )
-            acpi_power_off();
-    }
-
     return continue_hypercall_on_cpu(0, enter_state_helper, &acpi_sinfo);
 }